#include <bits/stdc++.h>
using namespace std;

const int N = 100005;
int a[N],x,n,s=0,ans=0;

void pprint()
{
    for (int i = 1;i <= n;i++){
        if (a[i])
        {
            cout << i << "  " << a[i] << endl;
        }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin >> n;
    for (int i = 1;i <= n;i++)
    {
        cin >> x;
        a[x]++;
    }
    s = n;
    for (int i = 1;i <= 100000;i++)
    {
        if (a[i])
        {
            //cout <<" " << i << " " << s << " " <<n-a[i]-s << endl;
            s -= a[i];
            if (a[i] < s)
            {
                ans += a[i];
            }
            else
            {
                ans += s;
                break;
            }
            //cout << i << "  " << a[i] << " " << s << endl;
        }
    }
    cout << n - ans;
    //pprint();
    return 0;
}

